<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>07_监视属性</title>
    </head>
    <body>
        <div id="app">
            姓:<input type="text" v-model="firstName" /> <br />
            名:<input type="text" v-model='lastName' /> <br />
            <p>姓名:{{fullName}}</p>
        </div>
        <script src="../../0516/01/vue.js"></script>
        <script>
            const vm = new Vue({
                data:{
                    firstName:'',
                    lastName:'',
                    fullName:'',
                },
                watch:{
                    firstName(firstName){
                        this.fullName= firstName+''+this.lastName;
                    },
                    lastName(lastName){
                        this.fullName = this.firstName + '' + lastName;
                    },
                },
            });
            vm.$mount('#app');
        </script>
    </body>
</html>